﻿@model List<WorldRankingListEntry>

@{
    ViewBag.Title = "Verdensranglisten";
    var actionName = "WorldRanking";
}

<div class="page-header">
    <h1><span class="glyphicon glyphicon-tower"></span> @ViewBag.Title</h1>
</div>
<ul class="pagination">
    <li>@Html.ActionLink("idag", actionName, new { date = DateTime.Now.ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("imorgen", actionName, new { date = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("i går", actionName, new { date = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("i forgårs", actionName, new { date = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("7 dage siden", actionName, new { date = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("14 dage siden", actionName, new { date = DateTime.Now.AddDays(-14).ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("én måned siden", actionName, new { date = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("ét år siden", actionName, new { date = DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd") })</li>
</ul>

<h2>Stilling pr. @ViewBag.FromDate.ToLongDateString()</h2>
<hr />
<table class="table table-striped text-center">
    <thead>
        <tr>
            <th class="text-center">#</th>
            <th>
                Spiller
            </th>
            <th>Point</th>
            <th>point ialt</th>
            <th>gns. brutto</th>
            <th>gns. netto</th>
            <th>gns. stbl</th>
            <th class="hidden-xs">runder</th>
            <th class="hidden-xs hidden-sm">seneste runde</th>
            <th class="hidden-xs hidden-sm">ældste runde</th>
        </tr>
    </thead>

    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.TiedPositionIndicator)
                    @Html.DisplayFor(modelItem => item.Position)
                </td>
                <td class="text-left">
                    <span class="hidden-xs hidden-sm">
                        @if (item.Player.IsActive)
                        {
                            @Html.DisplayFor(modelItem => item.Player.DisplayName)
                        }
                        else
                        {
                            <del>@Html.DisplayFor(modelItem => item.Player.DisplayName)</del>
                        }
                    </span>
                    <span class="hidden-md hidden-lg">
                        @if (item.Player.IsActive)
                        {
                            @Html.DisplayFor(modelItem => item.Player.Initials)
                        }
                        else
                        {
                            <del>@Html.DisplayFor(modelItem => item.Player.Initials)</del>
                        }
                    </span>
                </td>



                <td>
                    @Html.DisplayFor(modelItem => item.Points)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.PointsTotal)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AverageBruttoscore)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AverageNettoscore)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AverageStablefordPoints)
                </td>
                <td class="hidden-xs">
                    @if (item.NumberOfRounds < item.Divident)
                    {
                        <span style="color:silver;">@Html.DisplayFor(modelItem => item.NumberOfRounds)</span>
                    }
                    else
                    {
                        @Html.DisplayFor(modelItem => item.NumberOfRounds)
                    }
                </td>
                <td class="hidden-xs hidden-sm">
                    @item.LatestMatchDate.ToLongDateString()
                </td>
                <td class="hidden-xs hidden-sm">
                    @item.EarliestMatchDate.ToLongDateString()
                </td>
            </tr>
        }
    </tbody>
</table>
